/**
 * 
 */
package org.softTank.BC.rs.resource;

import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.softTank.BC.manager.ServiceManager;
import org.softTank.BC.rs.bean.ServiceBean;

/**
 * @author Yuzone
 *
 */
public class ServiceResource {

	private String typeID;
	private String categoryID;

	public ServiceResource() {
	}

	public ServiceResource(String typeID, String categoryID) {
		this.typeID = typeID;
		this.categoryID = categoryID;
	}

	@GET
	@Produces(MediaType.APPLICATION_XML)
	public List<ServiceBean> getServices() {
		ServiceManager sm = new ServiceManager();
		return typeID.equalsIgnoreCase("sjfw") ? sm.getDataServices(categoryID)
				: sm.getFunctionServices(categoryID);
	}

	@GET
	@Path("{serviceID}")
	@Produces(MediaType.APPLICATION_XML)
	public ServiceBean getService(@PathParam("serviceID") String serviceID) {
		return new ServiceManager().getService(serviceID);
	}
}
